package 练手;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class test1 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"001","002","003","004","005");
        Random random=new Random();
        int index=random.nextInt(list.size());//规定随机数在0-4
        String name=list.get(index);
        System.out.println(name);

        //打乱
        Collections.shuffle(list);

        //带有概率，random不可用

    }
}
